<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>个人中心</title>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="/css/personal.css">
</head>
<body>
<div class="header">
    <div class="logo">
        <img src="/images/Logo.png">
    </div>
    <div class="title">
        <p>{{$user->username}}的个人中心</p>
    </div>
    <div class="nav">
        <ul>
            <li><a href="/">返回系统首页</a></li>
        </ul>
    </div>
</div>
<div class="content">
    <div class="left">
        <ul>
            <li>姓名：{{$user->username}}</li>
            <li>学号：{{$user->userid}}</li>
            <li>性别：{{$user->sex}}</li>
            <li>班级：{{$user->class}}</li>
            <li>学院：{{$user->unit}}</li>
        </ul>
    </div>
    <div class="right">
        <div class="result">
            @if(count($books) == 0)
                <p>您目前没有已借阅的书籍</p>
            @else
                <p>您一共有{{count($books)}}本已借书籍</p>
                <table border="1" cellspacing="0">
                    <tr>
                        <th>书号</th>
                        <th>书名</th>
                        <th>作者</th>
                        <th>出版社</th>
                        <th>类别</th>
                        <th>收录时间</th>
                        <th>归还时间</th>
                        <th>续借</th>
                        <th>还书</th>
                    </tr>
                    @foreach($books as $book)
                        <tr>
                            <td>{{$book->bookid}}</td>
                            <td>{{$book->name}}</td>
                            <td>{{$book->author}}</td>
                            <td>{{$book->publisher}}</td>
                            <td>{{$book->type}}</td>
                            <td>{{$book->created_at}}</td>
                            <td>{{$book->pivot->return_date}}</td>
                            <form action="/addTime/{{$book->id}}" method="POST">
                                <input type="hidden" name="_method" value="PUT"/>
                                <td><input type="submit" value="点击续借"></td>
                            </form>
                            <form action="/returnBook/{{$book->id}}" method="POST">
                                <input type="hidden" name="_method" value="DELETE"/>
                                <td><input type="submit" value="点击还书"></td>
                            </form>
                        </tr>
                    @endforeach
                </table>
            @endif
        </div>
    </div>
</div>
<div class="footer">
    &copy; 2017&nbsp;&nbsp;&nbsp;&nbsp;玉言为光小组版权所有&nbsp;&nbsp;&nbsp;&nbsp;未经授权&nbsp;&nbsp;&nbsp;&nbsp;不得转载&nbsp;&nbsp;&nbsp;&nbsp;杭电ICP备666666号
</div>
</body>
</html>